<div class="contents">
  <ol class="breadcrumb">
    <li><a href="#/index/panel">首页</a></li>
    <li><a href="#/ad/list">广告列表</a></li>
    <li class="active">编辑广告</li>
  </ol>
  <form class="form-horizontal" role="form" name="form" ng-submit="save()" novalidate>
    <div class="form-group" ng-class="{'has-error':form.title.$invalid && form.title.$dirty}">
      <label for="advertTitleInput" class="col-sm-2 control-label">广告位置</label>
      <div class="col-sm-5"><div style="line-height:40px;">{{ad.advertPosition | advertPositionRender}}</div></div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.title.$invalid && form.title.$dirty}">
      <label for="advertTitleInput" class="col-sm-2 control-label">标题</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" id="advertTitleInput" placeholder="广告标题" name="title" ng-model="ad.advertTitle" required="required">
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.link.$invalid && form.link.$dirty}">
      <label for="advertLinkInput" class="col-sm-2 control-label">链接地址</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" id="advertLinkInput" placeholder="链接地址" name="link" ng-model="ad.linkAddre" required="required">
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.pic.$invalid && form.pic.$dirty}">
      <label for="advertLinkInput" class="col-sm-2 control-label">图片地址<div class="text-muted">{{ad.advertPosition | advertPositionSizeRender}}</div></label>
      <div class="col-sm-5">
        <input type="text" class="form-control" id="advertLinkInput" placeholder="图片地址" name="pic" ng-model="ad.picAddre" required="required">
        <div class="btn btn-primary add-pic-btn">上传图片</div>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label"></label>
      <div class="col-sm-5">
        <img ng-src="{{ad.picAddre}}" />
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.startTime.$invalid && form.startTime.$dirty}">
      <label for="startDateInput" class="col-sm-2 control-label">开始日期</label>
      <div class="col-sm-5">
        <input type="date" class="form-control" id="startDateInput" placeholder="开始日期" name="startTime" ng-model="ad.startTime" required="required">
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.endTime.$invalid && form.endTime.$dirty}">
      <label for="endDateInput" class="col-sm-2 control-label">结束日期</label>
      <div class="col-sm-5">
        <input type="date" class="form-control" id="endDateInput" placeholder="结束日期" name="endTime" ng-model="ad.endTime" required="required">
      </div>
    </div>
    <div class="form-group" ng-class="{'has-error':form.sort.$invalid && form.sort.$dirty}">
      <label for="advertSortInput" class="col-sm-2 control-label">排序值</label>
      <div class="col-sm-5">
        <input type="number" class="form-control" id="advertSortInput" placeholder="排序值，越大越排前" value="10" name="sort" ng-model="ad.advertSort" required="required">
      </div>
    </div>
    <div class="form-group">
      <label for="advertSortInput" class="col-sm-2 control-label">状态</label>
      <div class="col-sm-5">
        <label class="radio-inline">
          <input type="radio" name="status" value="01" ng-model="ad.status">上架
        </label>
        <label class="radio-inline">
          <input type="radio" name="status" value="02" ng-model="ad.status">下架
        </label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-5">
        <button type="submit" class="btn btn-default">提交</button>
      </div>
    </div>
  </form>
</div>

<div load-script src="'/static/jquery.jUploader-1.01.js?5'" call-back="" charset="utf-8" ></div>
